Skip to content

feat(statics): add getTokenFeatures helper for AMS token feature diffs (CSHLD-935)#8897

Merged
manas-at-bitgo merged 1 commit into
masterfrom
manasladha035/cshld-935-get-token-features
May 29, 2026
Merged

feat(statics): add getTokenFeatures helper for AMS token feature diffs (CSHLD-935)#8897
manas-at-bitgo merged 1 commit into
masterfrom
manasladha035/cshld-935-get-token-features

Conversation

@manas-at-bitgo
Copy link
Copy Markdown
Contributor

@manas-at-bitgo manas-at-bitgo commented May 29, 2026

Summary

Adds a small helper to @bitgo-beta/statics:

getTokenFeatures(
  family: string,
  additionalFeatures: CoinFeature[] = [],
  excludedFeatures: CoinFeature[] = [],
): CoinFeature[]

Resolves the final feature list for a token — family default features (via the existing getNetworkFeatures lookup) plus additionalFeatures, minus excludedFeatures.

Consumed by the generated build/botTokens.ts once the AMS bot token generator is switched to call AMS with features=false (AMS already returns the per-token add/excl diff in that mode — see replaceWithFeatureDiffs in AMS). Keeps the generated file a single getTokenFeatures(...) call per token instead of inline new Set / .filter expressions in the constructor args.

Linear: CSHLD-935

Test plan

  • getTokenFeatures('eth') returns the same array as networkFeatureMapForTokens['eth'].
  • getTokenFeatures('eth', [CoinFeature.X]) includes X (deduped against family defaults).
  • getTokenFeatures('eth', [], [CoinFeature.Y]) removes Y from the family defaults.
  • getTokenFeatures('unknown-family') returns [] (no throw).
  • Statics package builds cleanly: `yarn workspace @bitgo-beta/statics build`.

Follow-up

  • AMS PR will switch scripts/generate-botTokens.ts to features=false and emit getTokenFeatures(...) calls in build/botTokens.ts. It depends on this one shipping first so the import resolves.

🤖 Generated with Claude Code

`getTokenFeatures(family, additionalFeatures?, excludedFeatures?)` resolves
the final feature list for a token: the family's default token features
(via the existing `getNetworkFeatures` lookup) plus `additionalFeatures`,
minus `excludedFeatures`. Both diff params default to `[]`.

Consumed by the generated `build/botTokens.ts` in BitGoJS once the AMS bot
token generator is switched to call AMS with `features=false` (AMS already
returns the add/excl diff in that mode). Keeps the generated file a single
`getTokenFeatures(...)` call per token instead of inline `new Set` /
`.filter` expressions.

TICKET: CSHLD-935

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@manas-at-bitgo manas-at-bitgo requested a review from a team as a code owner May 29, 2026 11:49
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 29, 2026

CSHLD-935

Copy link
Copy Markdown
Contributor

@abhi-bitgo abhi-bitgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@manas-at-bitgo manas-at-bitgo merged commit 68a24d8 into master May 29, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants